package com.ray.service;

import com.ray.dao.UserDao;
import com.ray.pojo.User;
import org.springframework.context.ApplicationContext;

import java.util.List;

public class UserServiceImpl implements UserService
{
    UserDao userDao;

    public void setUserDao(UserDao userDao)
    {
        this.userDao = userDao;
    }

    /**
     * @param id
     * @return
     */
    @Override
    public User getUserById(long id)
    {
        // 以前都需要 UserDao userDao = new UserDao();下面才可以使用，现在直接使用Spring控制生成这个userDao了。
        User user = userDao.getUserById(id);
        return user;
    }

    /**
     * @return
     */
    @Override
    public List<User> getUserList()
    {
        List<User> userList = userDao.getUserList();
        return userList;
    }
}
